#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int n, l, r, x;
const int N = 20;
int q[N], b[N];
int main()
{
    cin >> n >> l >> r >> x;
    for (int i = n - 1; i >= 0; i--)
        scanf("%d", &q[i]);
    int flag = pow(2, n);
    int num = 0;
    int ma = 1e6 + 1;
    int mi = 0;
    for (int i = 0; i < flag; i++)
    {
        int sum = 0;
        int j = n - 1;
        for (j = n - 1; j >= 0; j--)
        {
            while(b[j])
                b[j] = 0;
            if (b[j] == 0)
            {
                b[j] = 1;
                break;
            }
        }
        for (j = n - 1; j >= 0; j--)
            cout << b[j];
        cout << endl;
        for (j = n - 1; j >= 0; j--)
        {
            if (b[j])
            {
                ma = max(ma, b[j]);
                mi = min(mi, b[j]);
                sum += q[j];
            }
        }
        if (ma - mi < x)
            continue;
        if (sum >= l && sum <= r)
            num++;
    }
    cout << num;
    return 0;
}